package com.ah.shanxi_demo.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 工单通用枚举
 * @author zt 2020/8/24
 */
public enum OrderCommonEnum implements PolicyCommonInterface {

    //工单状态
    STATUS_INIT("0", "未处理"),
    STATUS_SUCCESS("1", "处理成功"),
    STATUS_UNDONE("2", "处理中"),
    STATUS_FAIL("-1", "处理失败"),


    ;
    private String key;
    private String value;

    final static Map<String, OrderCommonEnum> cacheOrder = new HashMap<>(values().length);

    static {
        for (OrderCommonEnum orderCommonEnum : values()) {
            cacheOrder.put(orderCommonEnum.key, orderCommonEnum);
        }
    }


    OrderCommonEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static OrderCommonEnum convert(String key) {
        OrderCommonEnum type = cacheOrder.get(key);
        return type;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public Integer getKeyInt() {
        return Integer.parseInt(key);
    }
}
